<?php
/**
 * Created by PhpStorm.
 * Author: Shadow
 * Date: 2022/4/7
 * Time: 3:34 下午
 * description: reponse.php
 * 封装一个公共响应方法
 */

/**
 * 响应成功的方法
 * @param $data
 * @param string $msg
 * @param string $code
 * @return false|string
 */
function success($data =[], $msg='ok', $code = '200'){
    return json_encode([
        'code' => $code,
        'data' => $data,
        'msg' => $msg
    ]);
}
